#region License Revision: 0 Last Revised: 6/18/2008 11:00 AM
/******************************************************************************
Copyright (c) Microsoft Corporation.  All rights reserved.


This file is licensed under the Microsoft Public License (Ms-PL). A copy of the Ms-PL should accompany this file. 
If it does not, you can obtain a copy from: 

http://www.microsoft.com/resources/sharedsource/licensingbasics/publiclicense.mspx
******************************************************************************/
#endregion // License
using System;
using System.Windows.Browser;
using System.Diagnostics;
using ScriptInterop;

namespace VIEWS // Virtual Earth Wrapper
{

/// <summary>Provides optional attributes for a multi-point route.</summary>
public class VERouteOptions : JSObject
{
	/// <summary>String holding JavaScript class name</summary>
	private static string thisClass = "VERouteOptions";
	
	/// <summary>Get the JavaScript class name</summary>
	/// <returns type="String">The class name used in JavaScript </returns>		
	public override string ClassName
	{
		get { return thisClass; }
	}

	/// <summary>Construct a C# wrapper from a ScriptObject</summary>
	/// <param name="so">A ScriptObjet from JScript.</param>
	public VERouteOptions(ScriptObject so) : base(so) { }

	/// <summary>Construct a default RouteOptions object</summary>
	public VERouteOptions()
	{ 
		ScriptObject = CreateClass();
	}

	/// <summary>Construct a default RouteOptions object with all the parameters</summary>
	/// <param name="distanceUnit">A VERouteDistanceUnit Enumeration value specifying the units used by the route. Optional. The default value is VERouteDistanceUnit.Mile.</param>		
	/// <param name="drawRoute">A Boolean value specifying whether the route is drawn on the map. Optional. The default value is true</param>
	/// <param name="routeCallback">The name of the function called when the method has generated the route. The default value is null. The called function receives a VERoute Class object.</param>
	/// <param name="routeColor">A VEColor Class object specifying the color of the route line. The default value is default is VEColor(0,169,235,0.7).</param>
	/// <param name="routeOptimize">A VERouteOptimize Enumeration value specifying how the route is optimized. The default value is VERouteOptimize.Default, which means the route is calculated in the order in which the locations are specified.</param>
	/// <param name="routeWeight">The thickness, in pixels, of the route line. The default value is 6 pixels.</param>
	/// <param name="routeZIndex">The z-index of the route line. The default value is 4.</param>
	/// <param name="setBestMapView">A Boolean value specifying whether the map view is set to the best view of the route after it is drawn. The default is true.</param>
	/// <param name="showDisambiguation">A Boolean value specifying whether a disambiguation dialog box is shown. The default value is true.</param>
	/// <param name="showErrorMessages">Whether to show any error messages. The default value is true.</param>
	/// <param name="useMWS">A Boolean value specifying whether to use the MapPoint Web Service to generate the route. The default value is false.</param>
	public VERouteOptions(VERouteDistanceUnit distanceUnit, bool drawRoute, string routeCallback, VEColor routeColor, VERouteOptimize routeOptimize, int routeWeight, int routeZIndex, bool setBestMapView, bool showDisambiguation, bool showErrorMessages, bool useMapPointWebService)
	{
		ScriptObject = CreateClass(ScriptEnumConverter.ToString(distanceUnit), drawRoute, routeCallback, (ScriptObject)routeColor, ScriptEnumConverter.ToString(routeOptimize), routeWeight, routeZIndex, setBestMapView, showDisambiguation, showErrorMessages, useMapPointWebService);
	}
	
	/// <summary name="DistanceUnit">A VERouteDistanceUnit Enumeration value specifying the units used by the route.</summary>		
	public VERouteDistanceUnit DistanceUnit
	{
		get { return ScriptEnumConverter.ToRouteDistanceUnit(GetProperty<string>("DistanceUnit")); }
        set { SetProperty("DistanceUnit", ScriptEnumConverter.ToString(value)); }
	}
	/// <summary name="DrawRoute">A Boolean value specifying whether the route is drawn on the map.</summary>
	public bool DrawRoute
	{
		get { return GetProperty<bool>("DrawRoute"); }
		set { SetProperty("DrawRoute", value); }
	}
	// delegate type for the route callback
	// public delegate void RouteInfoCallback(object objRoute);
	/// <summary name="RouteCallback">The name of the JavaScript function called when the method has generated the route.</summary>
	public object RouteCallback
	{
		get { return GetProperty<object>("RouteCallback"); }
		set { SetProperty("RouteCallback", value); }
	}
	/// <summary name="RouteColor">A VEColor Class object specifying the color of the route line.</summary>
	public VEColor RouteColor
	{
		get { var so = GetProperty<ScriptObject>("RouteColor"); return new VEColor(so); }
		set { SetProperty("RouteColor", (ScriptObject)value); }
	}

    /// <summary name="VERouteMode">A VERouteMode Enumeration value specifying the mode of route to return</summary>
    public VERouteMode RouteMode
    {
        get { return ScriptEnumConverter.ToRouteMode(GetProperty<string>("RouteMode")); }
        set { SetProperty("RouteMode", ScriptEnumConverter.ToString(value)); }
    }


	/// <summary name="RouteOptimize">A VERouteOptimize Enumeration value specifying how the route is optimized.</summary>
	public VERouteOptimize RouteOptimize
	{
		get { return ScriptEnumConverter.ToRouteOptimize(GetProperty<string>("RouteOptimize")); }
		set { SetProperty("RouteOptimize", ScriptEnumConverter.ToString(value)); }
	}
	/// <summary name="RouteWeight">The thickness, in pixels, of the route line.</summary>
	public int RouteWeight
	{
		get { return GetProperty<int>("RouteWeight"); }
		set { SetProperty("RouteWeight", value); }
	}
	/// <summary name="RouteZIndex">The z-index of the route line.</summary>
	public int RouteZIndex
	{
		get { return GetProperty<int>("RouteWeight"); }
		set { SetProperty("RouteWeight", value); }
	}
	/// <summary name="SetBestMapView">A Boolean value specifying whether the map view is set to the best view of the route after it is drawn. </summary>
	public bool SetBestMapView
	{
		get { return GetProperty<bool>("SetBestMapView"); }
		set { SetProperty("SetBestMapView", value); }
	}
	/// <summary name="ShowDisambiguation">A Boolean value specifying whether a disambiguation dialog box is shown.</summary>
	public bool ShowDisambiguation
	{
		get { return GetProperty<bool>("ShowDisambiguation"); }
		set { SetProperty("ShowDisambiguation", value); }
	}
	/// <summary name="ShowErrorMessages">Whether to show any error messages.</summary>
	public bool ShowErrorMessages
	{
		get { return GetProperty<bool>("ShowErrorMessages"); }
		set { SetProperty("ShowErrorMessages", value); }
	}
    /// <summary name="UseMapPointWebService">A Boolean value specifying whether to use the MapPoint Web Service to generate the route.</summary>
	public bool UseMapPointWebService
	{
		get { return GetProperty<bool>("UseMWS"); }
		set { SetProperty("UseMWS", value); }
	}
} 

}
